<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
  <style>
    .container {
      position: absolute;
      width: 200px;
      height: 100px;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }
   

  </style>
</head>

<body>
  <div id="root"></div>
  <script>
    /* 
      1. v-if/v-show都可实现vue transition动画
      2. 自定义类名方式二
      - transition指定
        - enter-from-class
        - enter-to-class
        - enter-active-class
        - leave-from-class
        - leave-to-class
        - leave-active-class
      3. 自定义类名的应用场景
      - 可结合animate.css库实现动画效果
    */
    const app = Vue.createApp({
      template: `
      <div class="container">
        <transition
        enter-active-class="animate__animated animate__backInDown"
        leave-active-class="animate__animated animate__rotateOutUpRight"
        >
          <div v-if="isShow">Hello World1</div>
        </transition>
        <button @click="isShow = !isShow">切换</button>
      </div>
    `,
      data() {
        return {
          isShow: false
        }
      }
    })
    const vm = app.mount('#root');

  </script>
</body>

</html>